import http from '@/util/http.js'

/**
 * 查询mqtt用户列表
 * @param params
 */
export function getUsers(params) {
  return http({
    url: '/kadmin/getMqttUsers',
    method: 'post',
    data: params
  })
}

/**
 * 分页查询mqtt用户列表
 * @param params
 */
export function getMqttUserPage(params) {
  return http({
    url: '/kadmin/mqtt/getMqttUserPage',
    method: 'post',
    data: params
  })
}

/**
 * 登记mqtt用户
 * @param params
 * @returns {AxiosPromise}
 */
export function register(params) {
  return http({
    url: '/kadmin/mqtt/register',
    method: 'post',
    data: params
  })
}

/**
 * 关闭mqtt用户
 * @param params
 * @returns {AxiosPromise}
 */
export function closeUser(params) {
  return http({
    url: '/kadmin/mqtt/closeUser',
    method: 'post',
    data: params
  })
}

/**
 * 激活mqtt用户
 * @param params
 * @returns {AxiosPromise}
 */
export function openUser(params) {
  return http({
    url: '/kadmin/mqtt/openUser',
    method: 'post',
    data: params
  })
}

/**
 * 授权主题
 * @param params
 * @returns {AxiosPromise}
 */
export function topicPermit(params) {
  return http({
    url: '/kadmin/mqtt/topicPermit',
    method: 'post',
    data: params
  })
}

/**
 * 查询用户的主题权限
 * @param params
 * @returns {AxiosPromise}
 */
export function getUserTopicAuthPage(params) {
  return http({
    url: '/kadmin/mqtt/getUserTopicAuthPage',
    method: 'post',
    data: params
  })
}

/**
 * 同步用户、主题权限数据到kauth
 * @param params
 * @returns {AxiosPromise}
 */
export function syncKauthRedis(params) {
  return http({
    url: '/kadmin/mqtt/syncKauthRedis',
    method: 'post',
    data: params
  })
}
